﻿using System.Collections.ObjectModel;
using BomDiffAnalyst.Events;
using Prism.Commands;
using Prism.Dialogs;
using Prism.Events;
using Prism.Mvvm;
//using WpfExtensions.Xaml;

namespace BomDiffAnalyst.ViewModels
{
    public class LoginViewModel : BindableBase
    {
        private string _title = "Login";
        private IDialogService _dialogService;

        private IEventAggregator _ea;
        private ObservableCollection<string> _messages;


        public bool IsLogin { get; set; }

        public string UserName { get; set; }
        public string Password { get; set; }



        public DelegateCommand BtnLoginCommand { get; private set; }

        public string Title
        {
            get { return _title; }
            set
            {
                if (value != _title)
                {
                    SetProperty(ref _title, value);
                }
            }
        }





        public LoginViewModel(IEventAggregator ea,
                                IDialogService dialogService)
        {
            _ea = ea;

            BtnLoginCommand = new DelegateCommand(RunLoginCommand);
            _dialogService = dialogService;





        }

        private void RunLoginCommand()
        {
            //try
            //{
            //    App.Current.Dispatcher.BeginInvoke((Action)(async () =>
            //    {

            //    }));
            //}
            //catch (Exception ex)
            //{

            //}
            IsLogin = true;
            _ea.GetEvent<LoginSentEvent>().Publish(true);



        }






    }
}
